<#include "../../header.ftl" />
<@head title="论坛 - ${sitename}"/>
	<link media="all" href="${template_url}/style/bbs.css" rel="stylesheet">
	<script type="text/javascript" src="${base}/script/kindeditor/kindeditor.js" charset="utf-8"></script>
	<script type="text/javascript" src="${base}/script/mlog.editor.js" charset="utf-8"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			mlog.editor.init({
				model : "all",
				id : "content"
			});
		});
		
		function selType(obj, hid, val) {
	        var hid = document.getElementById(hid);
	        var aObjs = obj.parentNode.getElementsByTagName("a");
	        if (obj.className == "selected") {
	            obj.className = "";
	            hid.value = "";
	        } else {
	            for (var j = 0, len = aObjs.length; j < len; j++) {
	                aObjs[j].className = "";
	            }
	            obj.className = "selected";
	            hid.value = val;
	        }
	        $(obj).blur();
	    }
	</script>
	<@nav current="论坛"/>
	<div class="container">
		<div class="grid grid-4">
			<div class="box">
				<div class="box-title">资讯分类</div>
			   	<div class="box-body">
			   		<div class="typo-p">
			   			<@m.widget path="/widget/news/catalog" idle=86400/>
			   		</div>
			   	</div>
			</div>
		</div>
		<div class="grid grid-16 last">
			<@spring.bind "topic" />
			<form action="${base}/forums/topic/post/save" method="post">
				<table class="post-table">
					<tr>
						<td class="fieldLabel">标题：</td>
						<td>
							<@spring.formInput path="topic.title" attributes="class='input' style='width:100%;'"/>
						</td>
					</tr>
					<tr>
						<td class="fieldLabel">分类：</td>
						<td>
							<@spring.formHiddenInput path="topic.forum.id" defaultValue="${forum!''}" />
							<p class="pType">
								<#if (forums?exists && forums?size > 0)>
									<#list forums as f>
										<a href="javascript:void(0);" <#if forum?has_content && forum == f.id>class="selected"</#if> onclick="selType(this,'forum', ${f.id})">${f.name}</a>
									</#list>
								</#if>
                    		</p>
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<@spring.formTextarea path="topic.content" attributes="style='width:100%;height:300px;'" />
						</td>
					</tr>
					<tr>
						<td colspan="2" style="text-align:right;">
							<input type="submit" class="button" value="发表"/>
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
<#include "../../footer.ftl" />